
if (@CMAKE_SYSTEM_NAME@ MATCHES "Windows")
  execute_process(COMMAND "@CMAKE_COMMAND@" -E rm -rf "@CMAKE_INSTALL_PREFIX@/@PROJECT_NAME@")
else ()
  if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
    message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
  endif()

  file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
  string(REGEX REPLACE "\n" ";" files "${files}")

  foreach (file ${files})
    set(UNINSTALL_PREFIX "$ENV{DESTDIR}")

    message(STATUS "Uninstalling \"$UNINSTALL_PREFIX${file}\"")
    if (EXISTS "$UNINSTALL_PREFIX${file}")
      exec_program("@CMAKE_COMMAND@" ARGS "-E remove \"$UNINSTALL_PREFIX${file}\""
                  OUTPUT_VARIABLE rm_out
                  RETURN_VALUE rm_retval)
      if (NOT "${rm_retval}" STREQUAL 0)
        message(SEND_ERROR "Problem when removing \"$UNINSTALL_PREFIX${file}\"")
      endif()
    elseif (IS_SYMLINK "$UNINSTALL_PREFIX${file}")
      exec_program("@CMAKE_COMMAND@" ARGS "-E remove \"$UNINSTALL_PREFIX${file}\""
                  OUTPUT_VARIABLE rm_out
                  RETURN_VALUE rm_retval)
      if (NOT "${rm_retval}" STREQUAL 0)
        message(SEND_ERROR "Problem when removing symlink \"$UNINSTALL_PREFIX${file}\"")
      endif()
    else()
      message(STATUS "File \"$UNINSTALL_PREFIX${file}\" does not exist.")
    endif()
  endforeach()
endif()

